/**
 * Title:		KFrogSymbolTable.java
 * Description: This class represents a symbol table. 
 * 
 * @version		1.0 May 2009
 * @author		Rami Habas
 */

package kfrog;

import java.util.Hashtable;
import kfrog.type.KFrogDataType;

public class KFrogSymbolTable extends Hashtable<String,KFrogDataType> {

	private static final long serialVersionUID = 5953041351808579547L;

	/** the symbol table read-only access bit */
	private boolean readOnly;
	
	/** static parent */
	private KFrogSymbolTable staticParent;
	
	/** dynamic parent */
	private KFrogSymbolTable dynamicParent;

	/**
     * Constructor used to instantiate a symbol table with the given static and
     * dynamic parents.
     * 
     * @param staticParent    Static parent
     * @param dynamicParent   Dynamic parent
     */
	KFrogSymbolTable(KFrogSymbolTable staticParent, 
			KFrogSymbolTable dynamicParent) {
		readOnly = false;
		this.staticParent = staticParent;
		this.dynamicParent = dynamicParent;
	}

	public void setReadOnly() {
		readOnly = true;
	}

	public final KFrogSymbolTable getStaticParent() {
		return staticParent;
	}

	public final KFrogSymbolTable getDynamicParent() {
		return dynamicParent;
	}

	public boolean isReadOnly() {
		return readOnly;
	}
}
